﻿/*
 * The MIT License (MIT)
 * 
 * Copyright (c) 2012 Brno University of Technology - Faculty of Information Technology (http://www.fit.vutbr.cz)
 * Author(s):
 * Vladimir Vesely (mailto:ivesely@fit.vutbr.cz)
 * Martin Mares
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 
 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

using System;

namespace PcapMerger
{
    /// <summary>
    /// Interface
    /// </summary>
    public interface IPmFrame : IComparable
    {
        #region Interface functions for safe access to variables

        /// <summary>
        /// Type of frame in sense of PCAP fileformat
        /// </summary>
        /// <returns>Returns appropriate frame type</returns>
        PmSupportedTypes.CaputreFileFrameType Type();
        /// <summary>
        /// Function gets raw data of frame
        /// </summary>
        /// <returns>Returns frame data in form of byte field</returns>
        byte[] Data();
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        PmSupportedTypes.LinkTypes LinkType();
        /// <summary>
        /// Function gets timestamp of frame
        /// </summary>
        /// <returns>Returns GMT DateTime</returns>
        DateTime TimeStamp();
        /// <summary>
        /// Original length of packet as captured by sniffing engine
        /// </summary>
        /// <returns>Returns length of packet in bytes</returns>
        UInt32 OriginalLength();
        /// <summary>
        /// Length of packet data that are actually stored in PCAP file, could me less than OriginalLength
        /// </summary>
        /// <returns>Returns actual length of packet in bytes</returns>
        UInt32 IncludedLength();
        /// <summary>
        /// Function gets starting offset of frame inside some PCAP files
        /// </summary>
        /// <returns>Starting offset</returns>
        UInt32 FrameOffset();

        #endregion

        /// <summary>
        /// Function compares two IPmFrames between each other
        /// </summary>
        /// <param name="other">Another IPmFrame</param>
        /// <returns></returns>
        int CompareTo(IPmFrame other);
    }
}
